#ifndef __ORDER_ANALYSE_H__
#define __ORDER_ANALYSE_H__
#include "order.h"

typedef struct order_hash_s{
    char orderCh[16]; 
    TokenType_ orderType;
}order_hash_t;

static order_hash_t order_list[] = {
    {"puts", ORDER_PUTS},
    {"error", ORDER_ERROR},
    {"error", ORDER_ERROR},
    {"error", ORDER_ERROR},
    {"error", ORDER_ERROR},
    {"error", ORDER_ERROR},
    {"mkdir", ORDER_MKDIR},
    {"error", ORDER_ERROR},
    {"error", ORDER_ERROR},
    {"pwd", ORDER_PWD},
    {"remove", ORDER_REMOVE},
    {"error", ORDER_ERROR},
    {"error", ORDER_ERROR},
    {"rmdir", ORDER_RMDIR},
    {"error", ORDER_ERROR},
    {"cd", ORDER_CD},
    {"ls", ORDER_LS},
    {"error", ORDER_ERROR},
    {"error", ORDER_ERROR},
    {"error", ORDER_ERROR},
    {"error", ORDER_ERROR},
    {"gets", ORDER_GETS},
    {"error", ORDER_ERROR}
};

// 哈希表长
static const int HASH_COUNT = sizeof(order_list) / sizeof(order_list[0]);
int hashOpcode(train_chdata* ch);
TokenType_ orderAnalHash(train_chdata* ch);
int order_judg(train_chdata* ch, order_train_t* od);                        
int sendTrain(int sockfd, order_train_t* orderTrain);
int recvTrain(int sockfd, order_train_t* train);
#endif
